package org.beian.fmmall.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.beian.fmmall.VO.ResultVO;
import org.beian.fmmall.service.CategoryService;
import org.beian.fmmall.service.IndexImgService;
import org.beian.fmmall.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/index")
@Api(tags = "首页管理",value = "提供首页数据显示所需要的数据")
public class IndexController {
    @Autowired
    private IndexImgService indexImgService;
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private ProductService productService;
    @GetMapping("/imgs")
    @ApiOperation("首页轮播图接口")
    public ResultVO listIndexImg(){
        return indexImgService.listIndexImg();
    }

    @GetMapping("/categoryList")
    @ApiOperation("商品分类查询接口")
    public ResultVO listCategories(){
        return categoryService.listCategories();
    }
    @GetMapping("/RecommendProducts")
    @ApiOperation("查询推荐商品接口")
    public ResultVO listRecommendProducts(){
        return productService.listRecommendProducts();
    }
    @GetMapping("/Top6Categories")
    @ApiOperation("查询一级分类商品销量前六名接口")
    public ResultVO listTop6Categories(){
        return categoryService.listTop6Categories();
    }
}
